import { Context } from "koa";
import { DbUtils, dealDbMessage } from "../utils";
const collectionList = ["users", "shops", "goods", "goodType"];

export const checkCollection = async (
  data: any,
  ctx: Context
): Promise<string> => {
  if (data.collectoin) {
    // if (!collectionList.includes(data.collection)) {
    //   await DbUtils.createCollection(data.collection);
    // }
    return data.collectoin;
  } else {
    ctx.body = dealDbMessage(null, 404, "没有找到对应的表");
    return "";
  }
};
